package org.andao.commons.lucene.core.mapper;

import org.apache.solr.common.SolrInputDocument;

/**
 * 动态域（自定义域名和值）mapper
 * <ul>
 * <li>doc2.addField( "name_s", "冰羽", 1.0f );// '_s'结尾代表是string</li>
 * <li>doc2.addField( "price_i", 20 );// '_i'结尾代表int</li>
 * <li>具体其他后缀，请参见solr服务器中的schema.xml</li>
 * </ul>
 * 
 * @author Seewo Software - Vick.liu (liuguanglin@cvte.cn)
 * 
 */
public abstract class BeanDynamicMapper implements BeanMapper {

	@Override
	public Object mapBean(Object sourceObject, int rowNum) {
		return mapDynamicFields(sourceObject);
	}

	/**
	 * 设置动态索引域（自定义域名和值）
	 * <ul>
	 * <li>doc2.addField( "name_s", "冰羽", 1.0f );// '_s'结尾代表是string</li>
	 * <li>doc2.addField( "price_i", 20 );// '_i'结尾代表int</li>
	 * <li>具体其他后缀，请参见solr服务器中的schema.xml</li>
	 * </ul>
	 * 
	 * @param sourceObject
	 * @return
	 */
	public abstract SolrInputDocument mapDynamicFields(Object sourceObject);
}
